package com.schoolcloud.social.controller.forum;

import com.schoolcloud.common.model.PageDTO;
import com.schoolcloud.common.model.R;
import com.schoolcloud.social.dto.SocPostReplyDTO;
import com.schoolcloud.social.query.PostRepliesQuery;
import com.schoolcloud.social.service.PostInteractionService;
import com.schoolcloud.social.vo.SocPostRepliesVO;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RequiredArgsConstructor
@RestController
@RequestMapping("/social/posts/replies")
public class SocPostRepliesController {
    private final PostInteractionService postInteractionService;

    @GetMapping("/page")
    public R<PageDTO<SocPostRepliesVO>> getList(PostRepliesQuery query) {
        return R.ok(postInteractionService.getSocRepliesVOPage(query));
    }

    @PostMapping
    public R addSocPostReply(@RequestBody SocPostReplyDTO dto) {
        postInteractionService.addSocPostReply(dto);
        return R.ok();
    }
}
